<?php if(!isset($xml)):?>
<?php  echo $this->callElement("default/tools/tool_bar",array("buttons"=>array(array('type'=>'back')) ,"title" => "Language Manager")); ?>
<?php
        foreach($lang_fiels as $info):
            App::Module('DataGrid')->addRow($info['name'],$this->get_tag('a',Array('href'=>$this->baseurl("/developer/language/{$info['name']}")),'Edit') . " " . $this->get_tag('a',Array('href'=>"javascript:void(0)"),'Delete'));
        endforeach;

       App::Module('DataGrid')->setHeader(array('Language File', 'Option'))
                              ->Render();	
?>

<?php else: ?>
<?php  echo $this->callElement("default/tools/tool_bar",array("buttons"=>array(array('type'=>'back')) ,"title" => "{$xml->base->title} ({$xml->base->code})")); ?>

<form method="post" action="<?php echo $this->baseurl("/developer/language/{$lang_file}") ?>">
<input size="40" type="hidden" name="data[code]" value="<?php echo $xml->base->code;?>" />
<input size="40" type="hidden" name="data[title]" value="<?php echo $xml->base->title ?>" />

<?php

	$Grid = App::Module('DataGrid');

        $order = 0;
        foreach($xml->langs->lang as $val )
        {
	        $Grid->addRow(
                            '<input class="app_input" type="text" name="data[lang][' . $order .  '][key]" value="' . $val->key .'" />',
                            '<input class="app_input" type="text" name="data[lang][' . $order .  '][value]" value="' . $val->val .'" />'
                         );
           
            $order++;
        }

        $Grid->addRow(
                            '<input class="app_input" type="text" name="data[lang][' . ($order + 1) .  '][key]" value="" />',
                            '<input class="app_input" type="text" name="data[lang][' . ($order + 1) .  '][value]" value="" />'
                         );
        $Grid->setHeader(array('Language Code', 'Value'))
             ->Render();
?>

<?php endif; ?>
    <?php  echo $this->callElement("default/tools/tool_bar",array("buttons"=>array(array('type'=>'save'),array('type'=>'back') ) ,"position" => 'bottom')); ?>
